import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    userId: 1,
    nickname: '',
    account: 'xzz',
    password: '',
    token: '',
    sex: '',
    phone: '',
    time: '',
    chatMessages: []
  },
  getters: {
  },
  mutations: {
    setUserId (state, userId) {
      state.userId = userId
    },
    setNickname (state, nickname) {
      state.nickname = nickname
    },
    setAccount (state, account) {
      state.account = account
    },
    setPassWord (state, password) {
      state.password = password
    },
    setToken (state, token) {
      state.token = token
    },
    setPhone (state, phone) {
      state.phone = phone
    },
    setSex (state, sex) {
      state.sex = sex
    },
    setTime (state, time) {
      state.time = time
    },
    updateChatMessages (state, messages) {
      state.chatMessages = messages
    }
  },
  actions: {
  },
  modules: {
  }
})
